/**
 * 
 */
package com.sx.cms.dao.impl;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.sx.cms.dao.ICityInfoDao;
import com.sx.cms.entity.CityInfoEntity;
import com.sx.core.BaseDao;
import com.sx.rbac.entity.SysUserEntity;

/**
 * @author Administrator
 *
 */
public class CityInfoDao extends BaseDao implements ICityInfoDao {
	private Log log = LogFactory.getLog(this.getClass());
	
	/* (non-Javadoc)
	 * @see com.sx.cms.dao.ICityInfoDao#queryAgenterUserCount(com.sx.cms.entity.CityInfoEntity)
	 */
	public Integer queryAgenterUserCount(CityInfoEntity cityinfo) {
		Integer count = new Integer(0);
		try {
			count = (Integer)getSqlMapClientTemplate().queryForObject("CMSCityInfo.queryAgenterUserCount", cityinfo);
		} catch (Exception e) {
			// TODO: handle exception
			log.error("获取代理经销商的账号信息出错",e);
		}
		return count;
	}

	/* (non-Javadoc)
	 * @see com.sx.cms.dao.ICityInfoDao#queryAgenterUserInfo(com.sx.cms.entity.CityInfoEntity)
	 */
	public List<SysUserEntity> queryAgenterUserInfo(CityInfoEntity cityinfo) {
		List<SysUserEntity> list = new ArrayList<SysUserEntity>();
		try {
			list = getSqlMapClientTemplate().queryForList("CMSCityInfo.queryAgenterUserInfo", cityinfo);
		} catch (Exception e) {
			// TODO: handle exception
			log.error("获取代理经销商的用户",e);
		}
		return list;
	}

	/* (non-Javadoc)
	 * @see com.sx.cms.dao.ICityInfoDao#findCityInfosTotal(com.sx.cms.entity.CityInfoEntity)
	 */
	public Integer findCityInfosTotal(CityInfoEntity cityinfo) {
		Integer count = new Integer(0);
		try {
			count = (Integer)getSqlMapClientTemplate().queryForObject("CMSCityInfo.findCityInfosTotal", cityinfo);
		} catch (Exception e) {
			// TODO: handle exception
			log.error("获取城市或代理经销商信息出错",e);
		}
		return count;
	}

	/* (non-Javadoc)
	 * @see com.sx.cms.dao.ICityInfoDao#findCityInfosByPaging(com.sx.cms.entity.CityInfoEntity)
	 */
	public List<CityInfoEntity> findCityInfosByPaging(CityInfoEntity cityinfo) {
		List<CityInfoEntity> list = new ArrayList<CityInfoEntity>();
		try {
			list = getSqlMapClientTemplate().queryForList("CMSCityInfo.findCityInfosByPaging", cityinfo);
		} catch (Exception e) {
			// TODO: handle exception
			log.error("获取城市或代理经销商信息出错",e);
		}
		return list;
	}

	/* (non-Javadoc)
	 * @see com.sx.cms.dao.ICityInfoDao#findCityInfos(com.sx.cms.entity.CityInfoEntity)
	 */
	public List<CityInfoEntity> findCityInfos(CityInfoEntity cityinfo) {
		List<CityInfoEntity> list = new ArrayList<CityInfoEntity>();
		try {
			list = getSqlMapClientTemplate().queryForList("CMSCityInfo.queryCityInfoWithAndInfo", cityinfo);
		} catch (Exception e) {
			// TODO: handle exception
			log.error("获取城市或代理经销商信息出错",e);
		}
		return list;
	}

}
